﻿Module FormUtils
    Public Declare Function SetWindowPos Lib "user32.dll" (ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, _
ByVal cy As Long, ByVal wFlags As Long) As Long
    Public Const MF_BYPOSITION = &H400&

    Public Declare Function RemoveMenu Lib "User32" (ByVal hMenu As Long, _
    ByVal nPosition As Long, ByVal wFlags As Long) As Long

    Public Declare Function GetSystemMenu Lib "User32" (ByVal hwnd As Long, _
    ByVal bRevert As Long) As Long
    Public Sub DisableClose(ByVal hWnd As Long)
        Dim hMenu As Long
        hMenu = GetSystemMenu(hWnd, 0)
        RemoveMenu(hMenu, 6, MF_BYPOSITION)
        RemoveMenu(hMenu, 5, MF_BYPOSITION)
    End Sub
End Module
